/**
 * Copyright (c) 2019 EOVA.CN. All rights reserved.
 * 
 * Licensed under the EPPL license: http://eova.cn/eppl.txt
 * For authorization, please contact: admin@eova.cn
 */
package com.oss.user;

import com.eova.aop.AopContext;
import com.eova.aop.MetaObjectIntercept;
import com.eova.common.utils.xx;

public class UserIntercept extends MetaObjectIntercept {

	@Override
	public void queryBefore(AopContext ac) throws Exception {

		String corporation = ac.user.getStr("corporation");
		String department = ac.user.getStr("department");
		String company = ac.user.getStr("company");
		int hotel_id=ac.user.get("hotel_id");

		if(!xx.isEmpty(corporation)){
			ac.condition = " and corporation = '" + corporation+"' ";
		}
		if(!xx.isEmpty(company)){
			ac.condition = " and company = '" + company+"' ";
		}
		if(!xx.isEmpty(department)){
			ac.condition = " and department = '" + department+"' ";
		}
		if(0!=hotel_id){
			ac.condition = " and id = " + hotel_id;
		}
	}

	public String addBefore(AopContext ac) throws Exception {

		return super.addBefore(ac);
	}

	/**
	 * 更新前置 自动设置更新时间(将update_time字段设为禁止修改，由此提供数据)
	 */
	@Override
	public String updateBefore(AopContext ac) throws Exception {

		return super.updateBefore(ac);
	}


}